<%= render 'head' %></br>
<body class="back body">
  <div class="container" id= "query">
    <table class="table table-bordered">
      <thead>
        <caption><h2>中医体质辨识与养生指导表</h2></caption>
      </thead>
      <tbody>
        <tr>
          <th width="180" class="center">姓名</th>
          <td width="60" class="center"><%=@result.name%></td>
          <th width="120" class="center">性别</th>
          <td width="60" class="center"><%=@result.sex%></td>
          <th width="120" class="center">年龄</th>
          <td width="60" class="center"><%=@result.age%></td>
          <th width="200" class="center">咨询日期</th>
          <td class="center"><%= datetime @result.created_at%></td>
        </tr>
        <tr>
          <th colspan="1" class="center">家庭住址</th>
          <td colspan="7"><%=@result.add%></td>
        </tr>
        <tr>
          <th colspan="1" class="center">体质类型</th>
          <td colspan="7"><p><%= @result.try(:score_result_type) %></p></td>
        </tr>
        <tr>
          <th colspan="1" class="center">体质结果</th>
          <td colspan="7" id="echart" style="height:300px;">*****</td>
        </tr>
        <tr>
          <th colspan="1" class="center">总体特征</th>
          <td colspan="7">
            <%= @result.body_type('totality') %>
          </td>
        </tr>
        <tr>
          <th colspan="1" class="center">形体特征</th>
          <td colspan="7">
            <%= @result.body_type('body') %>
          </td>
        </tr>
        <tr>
          <th colspan="1" class="center">常见表现</th>
          <td colspan="7">
            <%= @result.body_type('common') %>
          </td>
        </tr>
        <tr>
          <th colspan="1" class="center">心理特征</th>
          <td colspan="7">
            <%= @result.body_type('mentality') %>
          </td>
        </tr>
        <tr>
          <th colspan="1" class="center">发病倾向</th>
          <td colspan="7">
            <%= @result.body_type('tendency') %>
          </td>
        </tr>
        <tr>
          <th colspan="1" class="center">适应能力</th>
          <td colspan="7">
            <%= @result.body_type('adapt') %>
          </td>
        </tr>
        <tr>
          <th colspan="1" class="center">调养方法</th>
          <td colspan="7">
            <%= @result.body_type('tune') %>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
<script type="text/javascript">

  var arry = <%= @arry %>;

  var mychart = echarts.init(document.getElementById('echart'));
  var option = {
    title : {
        text: '',
    },
    tooltip : {
        trigger: 'axis'
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            data : ['平和型体质','气虚型体质','阳虚型体质','阴虚型体质','痰湿型体质','湿热型体质','血瘀型体质','气郁型体质','特禀型体质']
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'分数',
            type:'bar',
            data: arry,
            markPoint : {
                data : [
                    {type : 'max', name: '最大值'},
                    {type : 'min', name: '最小值'}
                ]
            },
            markLine : {
                data : [
                    {type : 'average', name: '平均值'}
                ]
            }
        }

    ]
};
  mychart.setOption(option);
</script>
</body>
